package com.tencent.sr.iris.basic.saas.service.model.operate;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.tencent.sr.iris.activity.interfaces.response.group.operate.OperateThirdBoardResponse;
import com.tencent.sr.iris.basic.saas.common.enums.IrisOrderStatusEnum;
import com.tencent.sr.iris.basic.saas.common.enums.YesOrNoEnum;
import com.tencent.sr.iris.basic.saas.common.utils.CommonUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@ApiModel(value = "团长任务列表-排行榜导出信息(运营视角)")
@Slf4j
@ColumnWidth(15)
public class OperateThirdRankExportInfo {
    @ExcelProperty(value = "序号", index = 0)
    private int num;

    @ExcelProperty(value = "是否有效", index = 1)
    private String isInLeaderboard;

    @ExcelProperty(value = "无效原因", index = 2)
    private String notInLeaderboarReason;

    @ExcelProperty(value = "uid", index = 3)
    private String irisUid;

    @ExcelProperty(value = "unionId", index = 4)
    private String wechatUserUnionid;

    @ExcelProperty(value = "昵称", index = 5)
    private String wechatUserNickname;

    @ExcelProperty(value = "当前等级", index = 6)
    private String userLevelSnapshot;

    @ExcelProperty(value = "下单时间", index = 7)
    private String orderTime;

    @ExcelProperty(value = "订单状态", index = 8)
    private String orderStatus;

    @ExcelProperty(value = "订单金额-gmv", index = 9)
    private Double orderAmount;

    @ExcelProperty(value = "订单编号", index = 10)
    private String plainOrderId;

    @ExcelProperty(value = "所属类目", index = 11)
    private Long categoryLevel3Id;

    @ExcelProperty(value = "团长佣金", index = 12)
    private Double userPredictCommissionFee;

    public void readFromSearchResponseData(OperateThirdBoardResponse response) {
        this.setIsInLeaderboard(YesOrNoEnum.getByValue(response.getIsInLeaderboard()));
        this.setNotInLeaderboarReason(response.getNotInLeaderboarReason());
        this.setIrisUid(response.getIrisUid());
        this.setWechatUserUnionid(response.getWechatUserUnionid());
        this.setWechatUserNickname(response.getWechatUserNickname());
        this.setUserLevelSnapshot(response.getUserLevelSnapshot());
        this.setOrderTime(response.getOrderTime());
        this.setOrderStatus(IrisOrderStatusEnum.getByStatus(response.getOrderEndStatus()));
        this.setOrderAmount(CommonUtils.longToDouble(response.getOrderAmount()));
        this.setPlainOrderId(response.getPlainOrderId());
        this.setCategoryLevel3Id(response.getCategoryLevel3Id());
        this.setUserPredictCommissionFee(CommonUtils.longToDouble(response.getUserPredictCommissionFee()));
    }
}
